﻿//========================================
// All rights reserved (C) 2017-2100
// CLR 版本：	4.0.30319.42000
// 命名空间:	SFJDService
// 文 件 名：	PH05ReStartReceive
// 作    者：	WooG
// 联系方式：	wooglle@163.com
// 创建时间：	2017/9/27 14:05:15
//========================================
using Network.UpdateData;
using SFJDService.TransportHandle;
using System;
using System.Net.Sockets;

namespace SFJDService.SocketHandle
{
    /// <summary>
    /// <para>TCP, code: 1306</para>
    /// <para>收到消息：TransGuid♠IPReceive♠NameReceive♠IPSend♠NameSend</para>
    /// </summary>
    class PH05ReStartReceive : PacketHandle
    {
        public PH05ReStartReceive(Socket socket, Packet packet) : base(socket, packet)
        {
        }

        protected void Handle2()
        {
            string[] buffe = Message.Split('♠');
            Guid guid = new Guid(buffe[0]);
            string[] buf = buffe[6].Split('♥');
            int[] ports = new int[buf.Length];
            for (int i = 0; i < buf.Length; i++)
            {
                ports[i] = Int32.Parse(buf[i]);
            }

            new TransportReceive(guid, ports, GetIpSend(), Int32.Parse(buffe[5]));
        }

        protected override void Handle()
        {
            string[] buffe = Message.Split('♠');
            Guid guid = new Guid(buffe[0]);
            FileReceive.tasks.Add(new ClassTransCSInfo(guid, buffe[1], buffe[2], buffe[3], buffe[4]));
            new FileReceive();
        }
    }
}
